#define DEBUG
#include <cstdio>
#include <cmath>
#define MAXN 50
#define MAXA 50
#define MAXSUMA 1500
#define MODS 1000000007

using namespace std;

long long fact[MAXN+1];

void initFact(int n) {
  fact[0] = 1;
  for (int i=1; i<=n; i++) {
    fact[i] = fact[i-1]*i%MODS;
  }
}

long long solve(int o, int sum, int n, int last, int *a) {
  static int book[MAXSUMA+1];
  if (o<=sum) {
    long long ret=0;
    for (int i=1; i<=n; i++) {
      if (i!=last && a[i]>0) {
	a[i]--;
	book[o] = i;
	ret = (ret+solve(o+1, sum, n, i, a))%MODS;
	a[i]++;
      }
    }
    return ret;
  } else {
    return 1;
  }
}

int main() {
  freopen("photo.in", "r", stdin);
  freopen("photo.out", "w", stdout);

  int a[MAXN+1];
  int n;
  scanf("%d", &n);
  for (int i=1; i<=n; i++) {
    scanf("%d", a+i);
  }
  initFact(MAXA);

  if (n==2) {
    if (abs(a[1]-a[2])==1) {
      printf("%lld\n", fact[a[1]]%MODS*fact[a[2]]%MODS);
    } else if (a[1]==a[2]) {
      printf("%lld\n", 2*fact[a[1]]%MODS*fact[a[2]]%MODS);
    } else {
      printf("0\n");
    }
  } else {
    int sum=0;
    for (int i=1; i<=n; i++) {
      sum += a[i];
    }
    long long temp=1;
    for (int i=1; i<=n; i++) {
      temp = temp*fact[a[i]]%MODS;
    }
    printf("%lld\n", solve(1, sum, n, 0, a)*temp%MODS);
  }

  fcloseall();
  return 0;
}
